<?php

// The file
$filename = '/tmp/test5.png';
$filename_out = '/tmp/badge9_out.png';
$src = '/tmp/badge9_out.png';  // source folder or file
$dest = '/var/www/html/badge/badge9_out.png';   // destination folder or file

// Content type
header('Content-Type: image/png');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$new_width = 224 ;
$new_height = 400;
// Resample

$image = imagecreatefrompng($filename);

$image = imagescale($image, $new_width, $new_height);
// Output
//imagepng($image, null, 0);
imagepng($image, $filename_out);
imagedestroy($image);
   
   shell_exec("cp -r $filename_out $dest");
   
   header( 'Location: download.php' ) ;
   
?>
